package com.shiguiwu.springmybatis.spring.primary;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @description: 首选bean
 * @author: stone
 * @date: Created by 2021/3/11 10:07
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.spring.primary
 */
public class PrimaryTests {

    public static void main(String[] args) {
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring/primary.xml");
        String[] beanDefinitionNames = applicationContext.getBeanDefinitionNames();
        for (String beanDefinitionName : beanDefinitionNames) {
            System.out.println(applicationContext.getBean(beanDefinitionName));

        }

        Person person = applicationContext.getBean(Person.class);
        System.out.println(person);

    }
}
